From 794cb6236fa256f8074c56f372eba05526e7c066 Mon Sep 17 00:00:00 2001 From: real-zephex Date: Tue, 2 Apr 2024 22:41:19 +0530 Subject: UI Upgrades for anime section. --- src/app/anime/[id]/[...animeId]/page.jsx | 81 ++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/app/anime/[id]/[...animeId]/page.jsx (limited to 'src/app/anime/[id]/[...animeId]/page.jsx') diff --git a/src/app/anime/[id]/[...animeId]/page.jsx b/src/app/anime/[id]/[...animeId]/page.jsx new file mode 100644 index 0000000..966f212 --- /dev/null +++ b/src/app/anime/[id]/[...animeId]/page.jsx @@ -0,0 +1,81 @@ +import { MediaPlayer, MediaProvider } from "@vidstack/react"; +import "@vidstack/react/player/styles/base.css"; +import "@vidstack/react/player/styles/plyr/theme.css"; +import { + PlyrLayout, + plyrLayoutIcons, +} from "@vidstack/react/player/layouts/plyr"; +import styles from "./video.module.css"; +import { redirect } from "next/navigation"; +import Link from "next/link"; + +export default async function Video({ params }) { + const id = params.animeId[0]; + const series = params.animeId[1]; + + // Getting the episode number and the anime name. Kindly ignore! + const words = id.split("-"); + const last_two = words.slice(-2).join(" "); + const remainingWords = words.slice(0, -2).join(" "); + + const data = await getVideoLink(id); + const animedata = await getAnimeInfo(series); + + if (data.message) { + redirect("/404"); + } + + const link = data.sources[4].url; + + return ( +
+
+

+ {last_two} - {remainingWords} +

+
+ + + + +
+ {animedata && + animedata.episodes.map((item, index) => ( + //

Hello World

+ + + + ))} +
+
+
+
+ ); +} + +async function getVideoLink(id) { + const res = await fetch( + "https://consumet-api-di2e.onrender.com/anime/gogoanime/watch/" + id + ); + const data = res.json(); + return data; +} + +async function getAnimeInfo(anime_id) { + const res = await fetch( + "https://anime-sensei-api.vercel.app/anime/gogoanime/info/" + anime_id, + { next: { revalidate: 7200 } } + ); + const data = await res.json(); + return data; +} -- cgit v1.2.3